using System;
using System.Threading.Tasks;
using SheLife.Domain.Entities;

namespace SheLife.Domain.Interfaces.Repositories
{
    /// <summary>
    /// 系统角色权限仓储接口
    /// </summary>
    public interface ISystemRolePermissionRepository : IRepository<SystemRolePermission>
    {
        /// <summary>
        /// 根据角色ID获取角色权限列表
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <returns>角色权限列表</returns>
        Task<IEnumerable<SystemRolePermission>> GetByRoleIdAsync(Guid roleId);

        /// <summary>
        /// 根据权限ID获取角色权限列表
        /// </summary>
        /// <param name="permissionId">权限ID</param>
        /// <returns>角色权限列表</returns>
        Task<IEnumerable<SystemRolePermission>> GetByPermissionIdAsync(Guid permissionId);

        /// <summary>
        /// 根据角色ID和权限ID获取角色权限
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <param name="permissionId">权限ID</param>
        /// <returns>角色权限</returns>
        Task<SystemRolePermission> GetByRoleIdAndPermissionIdAsync(Guid roleId, Guid permissionId);

        /// <summary>
        /// 检查角色是否拥有指定权限
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <param name="permissionCode">权限编码</param>
        /// <returns>是否拥有权限</returns>
        Task<bool> CheckRoleHasPermissionAsync(Guid roleId, string permissionCode);

        /// <summary>
        /// 获取角色的权限列表
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <returns>权限列表</returns>
        Task<IEnumerable<SystemPermission>> GetRolePermissionsAsync(Guid roleId);

        /// <summary>
        /// 批量为角色分配权限
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <param name="permissionIds">权限ID列表</param>
        /// <returns>执行结果</returns>
        Task<bool> AssignPermissionsToRoleAsync(Guid roleId, IEnumerable<Guid> permissionIds);

        /// <summary>
        /// 批量移除角色的权限
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <param name="permissionIds">权限ID列表</param>
        /// <returns>执行结果</returns>
        Task<bool> RemovePermissionsFromRoleAsync(Guid roleId, IEnumerable<Guid> permissionIds);
    }
}